package com.rich.broker.controller;

import com.rich.broker.service.WantService;
import com.rich.broker.vo.WantVo;
import com.rich.common.entity.TbWant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Package: com.rich.house.controller
 * @Author: 张dy
 * @Date: Created in 2021/8/13 下午 7:34
 * 经纪人只可查看求租求购
 */
@RestController
@RequestMapping("/want")
public class WantController {

    @Autowired
    private WantService wantService;

    /**
     *  全部求租求购
     * @Author: 张dy
     * @Date: 2021/8/13
     * @Param: []
     */
    @GetMapping("/findAll")
    public List<TbWant> findAll(){
        return wantService.findAll();
    }

    /**
     *  求租或者求购列表
     * @Author: 张dy
     * @Date: 2021/8/13
     * @Param: []
     */
    @PostMapping("/findByStatus/{status}")
    public List<WantVo> findByStatus(@RequestBody TbWant want,
                                     @PathVariable("status")String status){

        return wantService.findByStatus(want,status);
    }

}
